{% load debate_tags i18n l10n %}

{% tournament_side_names tournament 'abbr' as side_names %}

<div class="{% if pref.motion_vetoes_enabled %}col-sm-6{% else %}col-sm-12{% endif %}">

  <div class="row">
    <div class="col">

      <div class="progress">
        <div class="progress-bar progress-bar-aff" style="width: {{ motion.aff_win_percentage|unlocalize }}%">
          {% if motion.aff_win_percentage >= 5 %}
            {{ motion.aff_win_percentage|floatformat:"0" }}%
          {% endif %}
        </div>
        <div class="progress-bar progress-bar-neg" style="width: {{ motion.neg_win_percentage|unlocalize }}%">
          {% if motion.neg_win_percentage >= 5 %}
            {{ motion.neg_win_percentage|floatformat:"0" }}%
          {% endif %}
        </div>
      </div>

    </div>
  </div>

  <div class="row pb-3 mt-2">
    {% if motion.ndebates > 0 %}

      <div class="col text-left h6">
        <span class="text-aff pr-1 d-md-inline d-block">
          {% blocktrans trimmed with side=side_names.0 count count=motion.aff_wins %}
            {{ count }} {{ side }} win
          {% plural %}
            {{ count }} {{ side }} wins
          {% endblocktrans %}
        </span>
        <span class="text-neg pr-1 d-md-inline d-block">
          {% blocktrans trimmed with side=side_names.1 count count=motion.neg_wins %}
            {{ count }} {{ side }} win
          {% plural %}
            {{ count }} {{ side }} wins
          {% endblocktrans %}
        </span>
      </div>

      <div class="col-auto h6 text-muted" data-toggle="tooltip" title="{{ motion.χ2_info }}">
        {{ motion.χ2_label }}
      </div>

    {% else %}

      <div class="col text-muted h6">
        {% trans "No teams debated this motion" %}
      </div>

    {% endif %}
  </div>

</div>

{% if pref.motion_vetoes_enabled %}
  <div class="col-sm-6 col">

    <div class="row">
      <div class="col">
        <div class="progress">
          {% if motion.aff_veto_percentage %}
            <div class="progress-bar progress-bar-aff" style="width: {{ motion.aff_veto_percentage|unlocalize }}%">
              {% if motion.aff_veto_percentage >= 5 %}
                {{ motion.aff_veto_percentage|floatformat:"0" }}%
              {% endif %}
            </div>
          {% endif %}
          {% if motion.neg_veto_percentage %}
            <div class="progress-bar progress-bar-neg" style="width: {{ motion.neg_veto_percentage|unlocalize }}%">
              {% if motion.neg_veto_percentage >= 5 %}
                {{ motion.neg_veto_percentage|floatformat:"0" }}%
              {% endif %}
            </div>
          {% endif %}
        </div>

      </div>
    </div>

    <div class="row pb-3 mt-2">
      {% if motion.aff_vetoes or motion.neg_vetoes %}

        <div class="col text-left h6">
          <span class="text-aff pr-1 d-md-inline d-block">
            {% blocktrans trimmed with side=side_names.0 count count=motion.aff_vetoes %}
              {{ count }} {{ side }} veto
            {% plural %}
              {{ count }} {{ side }} vetoes
            {% endblocktrans %}
          </span>
          <span class="text-neg pr-1 d-md-inline d-block">
            {% blocktrans trimmed with side=side_names.1 count count=motion.neg_vetoes %}
              {{ count }} {{ side }} veto
            {% plural %}
              {{ count }} {{ side }} vetoes
            {% endblocktrans %}
          </span>
        </div>

        <div class="col-auto h6 text-muted" data-toggle="tooltip" title="{{ motion.veto_χ2_info }}">
          {{ motion.veto_χ2_label }}
        </div>

      {% else %}

        <div class="col text-muted text-right h6">
          {% trans "No teams vetoed this motion" %}
        </div>

      {% endif %}
    </div>

  </div>

{% endif %}
